package com.example.demo.respository;


import com.example.demo.model.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper {

    //按值（ID）查询
    @Select("select * from course where cid = #{cid}")
    Course findCourseById(Integer id);

    //查询表中所有数据
    @Select("select * from course")
    List<Course> findAllCourse();

    //插入数据
    @Insert("insert into course(cid,cname) values (#{cid},#{cname})")
    void insertCourse(Course course);

    //删除数据
    @Delete("delete from course where cid = #{cid}")
    void deleteCourse(int id);

    //更新数据
    @Update("update course set cid = #{cid},cname = #{cname} where cid = #{cid}")
    void updateCourse(Course course);

}
